“”“
日志类负责记录 Redhat 虚拟机操作的日志。
”“”
// Logger.h
#ifndef LOGGER_H
#define LOGGER_H

#include <iostream>
#include <fstream>
#include <string>
#include <mutex>
#include <thread>
#include <chrono>
#include <memory>
#include <sstream>

namespace ebackup {
namespace plugins {

class Logger {
public:
    enum LogLevel {
        INFO,
        WARNING,
        ERROR
    };

    Logger(const std::string& logFilePath);
    ~Logger();

    void log(const std::string& message, LogLevel level = INFO);

private:
    std::string logFilePath_;
    std::ofstream logFile_;
    std::mutex logMutex_;

    std::string getTimestamp();
};

} // namespace plugins
} // namespace ebackup

#endif // LOGGER_H